/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.library.backend;

import cz.muni.fi.pa165.library.api.UserRole;
import java.util.List;
import javax.persistence.EntityManager;

/**
 *
 * @author Filip Ligac
 */
public interface UserDAO {

    /**
     * Set entity manager. Useful for mocking tests.
     *
     * @param entityManager
     */
    void setEntityManager(EntityManager entityManager);

    /**
     * Creates a new user and stores it into database.
     *
     * @param user user entity to be created
     * @return created user
     * @throws IllegalArgumentException if user is null or user's attributes
     * are not correct or sufficient
     */
    public User createUser(User user);
   
    /**
     * Finds a user according to given username.
     *
     * @param username username of entity to be found
     * @return found user
     * @throws IllegalArgumentException if username is null
     */
    public User findUserByEmail(String email);

    /**
     * Deletes user from database.
     *
     * @param user user to be deleted
     * @return true if deleted successfully, false otherwise
     * @throws IllegalArgumentException if parameter is null
     */
    public void deleteUser(User user);


    public void updateUser(User user);
    
    public User findUserById(Long id);
}
